package com.ds.infra.ibatis.session;

import com.ds.infra.ibatis.executor.Executor;
import com.ds.infra.ibatis.executor.SimpleExecutor;

/**
 * 作用： 默认的SqlSessionFactory实现类
 *
 * @author WeiShaoying
 */
public class DefaultSqlSessionFactory implements SqlSessionFactory {

    private final Configuration configuration;

    public DefaultSqlSessionFactory(Configuration configuration) {
        this.configuration = configuration;
    }

    @Override
    public SqlSession openSession() {
        Executor executor = new SimpleExecutor(configuration);
        return new DefaultSqlSession(configuration, executor);
    }
}
